#pragma once

#include <vex/policy/safe_bool_base.h>
#include <vex/policy/protect_policy.h>
//#include <boost/operators.hpp>
//#include <boost/static_assert.hpp>
#include <iosfwd>

namespace vex { namespace policy {
    template < class TClass, class TClassTraits, class TBase = ::vex::policy::empty_base >
    class bool_convertible : public TBase
        //: public boost::totally_ordered1< bool_convertible< TClass, TClassTraits, TBase >, TBase >
    {
    public:
        // this will suffice, if we get explicit specifier for conversion operators
        //explicit operator bool() const
        //{
        //    return static_cast<TClass const*>(this)->get() ? true : false;
        //}

        //friend bool operator == (bool_convertible const &, bool_convertible const &)
        //{
        //    BOOST_STATIC_ASSERT_MSG(false, "illegal operation, define \"operator ==\" !");
        //}

        //friend bool operator < (bool_convertible const &, bool_convertible const &)
        //{
        //    BOOST_STATIC_ASSERT_MSG(false, "illegal operation, define \"operator <\" !");
        //}

        friend std::ostream& operator << (std::ostream&, bool_convertible const &)
        {
            static_assert(false, "illegal operation, define \"operator <<\" !");
        }

        friend std::wostream& operator << (std::wostream&, bool_convertible const &)
        {
            static_assert(false, "illegal operation, define \"operator <<\" !");
        }

        operator policy::safe_bool_base::unspecified_bool_type() const
        {
            return (static_cast<TClass const*>(this))->get() ?
                &safe_bool_base::converts_to_bool : nullptr;
        }

        VEX_PROTECT_POLICY(bool_convertible);
    };
}}